package com.tjvib.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.EditText;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.tjvib.R;
import com.tjvib.util.ToastUtil;
import com.tjvib.view.activity.AnalysisMethodActivity;

public class InputDialog extends Dialog {

    private EditText dialog_hint_et_con;

    public InputDialog(@NonNull Context context) {
        super(context);
    }

    public InputDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected InputDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }


    public void showDialog(Context context, String tit, String con, String hint,
                           View.OnClickListener pos, View.OnClickListener neg) {

        View view = LayoutInflater.from(context).inflate(R.layout.dialog_input, null);
        this.setContentView(view);
        this.setCanceledOnTouchOutside(false);
        this.show();

        TextView dialog_input_tv_tit = this.findViewById(R.id.dialog_input_tv_tit);
        dialog_input_tv_tit.setText(tit);

        dialog_hint_et_con = this.findViewById(R.id.dialog_hint_et_con);
        dialog_hint_et_con.setText(con);
        dialog_hint_et_con.setHint(hint);

        this.findViewById(R.id.dialog_input_btn_confirm).setOnClickListener(pos);
        this.findViewById(R.id.dialog_input_btn_cancel).setOnClickListener(neg);
    }


    public EditText getEtCon() {
        return dialog_hint_et_con;
    }
}
